package com.yincb.service;

import com.yincb.entity.User;
import com.yincb.entity.mapper.UserMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;


@Service
public class UserService {

    @Resource
    private UserMapper userMapper;


    public List<User> select(){
        List<User> users =
                userMapper.selectList(null);
        return users;
    }



    @Transactional
    public void insert(User user){


        userMapper.insert(user);
//
//        int i = 1/0;
//        User user1 = new User();
//        user1.setId(3L);
//        user1.setName("BO2");
//        userMapper.insert(user);

    }


}
